package com.ls.pattern.behavior.state;

//领取奖品
public class DispenseState implements State {
    private RaffleActivity activity;

    public DispenseState(RaffleActivity activity) {
        this.activity = activity;
    }

    @Override
    public void deduceMoney() {
        System.out.println("不能扣除积分");
    }

    @Override
    public boolean raffle() {
        System.out.println("不能抽奖");
        return false;
    }

    @Override
    public void dispensePrize() {
        if (activity.getCount() > 0){
            activity.subRaffle();
            System.out.println("恭喜中奖");
            activity.setState(activity.getNoRaffleState());
        }else {
            System.out.println("很遗憾奖品发送完了");
            activity.setState(activity.getDispenseState());
        }
    }
}
